package db

type Predictor[T DbEntity] interface {
	Predict(*T) bool
}

func Find[T DbEntity](list []T, pred Predictor[T]) *T {
	for i := range list {
		ptr := &list[i]
		if pred.Predict(ptr) {
			return ptr
		}
	}
	return nil
}
